/*
 * renegadesvs_driver.h
 *
 *  Driver to command a renegade base with a SVS system on top of a pan-tilt
 *
 *  Renegade motor controller is Sabertooth2X25 (http://www.dimensionengineering.com/Sabertooth2X25.htm)
 *  The controller is attached to SVS Master module bank 1 and is set to mode R/C mixed mode. So
 *  motor commands are sent via Srv servo commands [Ss]AB where A command translation speed and B
 *  command rotation speed.
 *
 *  The pant-tilt is just a pair of servos connected to SVS Master module bank 2
 *
 */

#ifndef RENEGADESVS_DRIVER_H_
#define RENEGADESVS_DRIVER_H_

#include "surveyorsvs_driver.h"
#include <geometry_msgs/Twist.h>
#include <surveyorsvs_driver/PTZState.h>

class RenegadeSVS_Driver: public SurveyorSVS_Driver{
public:
	RenegadeSVS_Driver(ros::NodeHandle nh);
	~RenegadeSVS_Driver();
	void poll();
private:
	void check_and_set_vel();
	void check_and_set_ptz();
	void cmdvel_cb(const geometry_msgs::TwistConstPtr &msg);
	void cmdptz_cb(const surveyorsvs_driver::PTZStateConstPtr &msg);

	ros::Subscriber cmdvel_sub, cmdptz_sub;
	double max_tv,max_rv,max_pan,max_tilt;
	ros::Time vel_time;
	geometry_msgs::Twist cmdvel;
	bool vel_dirty;
	ros::Time ptz_time;
	surveyorsvs_driver::PTZState cmdptz;
	bool ptz_dirty;
};


#endif /* RENEGADESVS_DRIVER_H_ */
